package com.example.springioc.demo3;

import com.example.springioc.demo3.model.Human;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-11-18
 * Time: 16:04
 */
@Component
public class BeanConfig {
    //@Primary
    @Bean("h1")
    public Human human1(){
        Human human = new Human();
        human.setName("zhangsan");
        human.setAge(18);
        System.out.println(human);
        return human;
    }

    @Bean
    public Human human2(){
        Human human = new Human();
        human.setName("zhangsan");
        human.setAge(18);
        return human;
    }



}
